import React, { useState } from "react";
import { Container } from "react-bootstrap";
import ProductPannel from "../layout/ProductPannel";
import { ProductionItemModel } from "../layout/ProductItem";
import { useNavigate } from "react-router-dom";


interface ProductListProps{
    productList?:Array<ProductionItemModel>
}

const ProductList:React.FC<ProductListProps> = (props:ProductListProps)=> {

    const navigate = useNavigate();

    const [productList,setProductList] = useState<Array<ProductionItemModel>>(props.productList||[])

    return (<Container fluid>
        <ProductPannel 
            showTitle={true} 
            title="All" 
            productList={productList}
            onClick={()=>{
                navigate("/mall/product/detail")
            }}
        />
    </Container>)
}

ProductList.defaultProps = {
    productList:[
        {
            productName:"羊羔绒床垫软垫床护垫垫被加绒单人加厚保暖防滑冬季单人学生宿舍",
            productSpecs:["新款"],
            productImg:"//gw.alicdn.com/bao/uploaded/i1/2206509550419/O1CN01Ewhgib1ExwpNszo58_!!0-item_pic.jpg_300x300q90.jpg",
            price:20.5,
            discount:0.8,
            flags:["送运费险","收藏上千"]
        },
        {
            productName:"奥克斯全钢折叠水壶旅行出差便携式烧水壶不锈钢电热水杯迷你家用",
            productSpecs:["新款"],
            productImg:"//gw.alicdn.com/bao/uploaded/i2/2928628469/O1CN01yaFWWA2CQr8vL8T1M_!!0-item_pic.jpg_300x300q90.jpg",
            price:179,
            discount:-1,
            flags:["送运费险","收藏上千"]
        },
        {
            productName:"尚都比拉优雅半身裙女2023新款秋冬通勤修身显瘦配腰带A字中长裙",
            productImg:"//gw.alicdn.com/bao/uploaded///asearch.alicdn.com/bao/uploaded/O1CN01FtfhUD1EFyoKYcTNb-712310323.jpg_300x300q90.jpg_.webp",
            price:269,
        },
        {
            productName:"电动车儿童座椅前置电瓶车小孩坐凳踏板车宝宝婴儿安全坐椅通用",
            productSpecs:["新款"],
            productImg:"//gw.alicdn.com/bao/uploaded/i1/2809996156/O1CN01QC8lqo1vLV3Srfbk1_!!2809996156.jpg_300x300q90.jpg_.webp",
            price:54.8,
            flags:["送运费险","收藏上千"]
        }
    ]
}

export default ProductList;